//
//  MyPageController.swift
//  maopu
//
//  Created by 黄海波 on 2017/4/12.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit

class MyPageController: BaseViewController {
    var i: Int!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.i = 0
        self.initView()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.setNavigationBarHidden(true, animated: true)
        if self.i % 2 == 0 {
            self.childViewControllers[1].view.removeFromSuperview()
            self.view.addSubview(self.childViewControllers[0].view)
        }
        else {
            self.childViewControllers[0].view.removeFromSuperview()
            self.view.addSubview(self.childViewControllers[1].view)
        }
        self.i = self.i + 1
    }
    func initView() {
        let loginedVC = LoginedController()
        self.addChildViewController(loginedVC)
        self.view.addSubview(loginedVC.view)
        
        let notLoginVC = NotLoginController()
        self.addChildViewController(notLoginVC)
        self.view.addSubview(notLoginVC.view)
    }
    
  }
